package com.hqd.ch03.v28.spel.ast;

import com.hqd.ch03.v28.spel.standard.ExpressionState;

public class OpNOT extends SpelNodeImpl {

    public OpNOT(int startPos, int endPos, SpelNodeImpl... operands) {
        super(startPos, endPos, operands);
    }

    @Override
    public Object getValue(ExpressionState state) {
        Boolean value = (Boolean) this.children[0].getValue(state);
        if (value == null) {
            throw new RuntimeException("Bool值为空");
        }
        return !value;
    }

}
